package com.mengyan.framework.model.response;

import lombok.Data;

/**
 * Created by mengyan on 2019/2/11.
 */
@Data
public class ResponseResultBase<T> implements  Response{
    //操作是否成功
    boolean success = SUCCESS;

    //操作代码
    int code = SUCCESS_CODE;

    //提示信息
    String message;

    T data;

    public ResponseResultBase(ResultCode resultCode,T data){
        this.success = resultCode.success();
        this.code = resultCode.code();
        this.message = resultCode.message();
        this.data = data;
    }

    public static ResponseResult SUCCESS(){
        return new ResponseResult(CommonCode.SUCCESS);
    }
    public static ResponseResult FAIL(){
        return new ResponseResult(CommonCode.FAIL);
    }
    public ResponseResultBase setMessage(String message) {
        this.message = message;
        return this;
    }
}
